package com.twu.biblioteca;

import com.twu.book.Book;
import com.twu.book.BookList;

import java.io.PrintStream;

/**
 * Created with IntelliJ IDEA.
 * User: root
 * Date: 6/28/13
 * Time: 1:07 AM
 * To change this template use File | Settings | File Templates.
 */
public class CommandReserve extends Command {
    @Override
    public CommandType type() {
        return CommandType.CMD_RESERVE;  //To change body of implemented methods use File | Settings | File Templates.
    }

    @Override
    public void execute(String param, PrintStream outputStream) {
<<<<<<< HEAD

        if( !Login.isLogged() )
        {
            BibliotecaShow.showNotLogged(outputStream);
            return;
        }

=======
>>>>>>> 35da6d08a71d87cd8b6d18bacb866f3b865fbf23
        Book book = BookList.findBookByNumber(param);
        if( book != null )
        {
            book.reserve(outputStream);
        }
        else
        {
            BibliotecaShow.showReserveFail(outputStream);
        }
        //To change body of implemented methods use File | Settings | File Templates.
    }

    public CommandReserve() {

    }
}
